/* ============================================
   Village Portal - Calendar Page CSS
   Complete styling for calender.html
   ============================================ */

:root {
  --color-primary: #0052CC;
  --color-primary-dark: #003d99;
  --color-primary-light: #4F8CFF;
  --color-secondary: #22223b;
  --color-text: #22223b;
  --color-text-light: #4b5563;
  --color-placeholder: #999;
  --color-border: #ddd;
  --color-error: #d32f2f;
  --color-success: #10b981;
  --color-bg-light: #f8f8f8;
  --color-white: #ffffff;
  --color-accent: #e0e7ff;
  --font-main: Arial, 'Helvetica Neue', sans-serif;
  --radius: 4px;
  --transition: 150ms ease;
}

/* ============================================
   Reset & Base Styles
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-white);
  margin-left: 250px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-dark);
}

/* ============================================
   Header & Navigation
   ============================================ */

.portal-header {
  background: linear-gradient(135deg, #1a5490 0%, #0052CC 100%);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex-wrap: wrap;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--color-white);
  flex-shrink: 0;
  min-width: 0;
}

.logo-img {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 5px;
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.portal-tagline {
  font-size: 0.8rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
}

.portal-nav {
  position: fixed;
  left: 0;
  top: 0;
  width: 250px;
  height: 100vh;
  background: linear-gradient(135deg, #1a5490 0%, #0052CC 100%);
  padding: 2rem 0;
  z-index: 101;
  overflow-y: auto;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nav-link {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  padding: 1rem 1.5rem;
  border-radius: 0;
  transition: all var(--transition);
  display: block;
  border-left: 4px solid transparent;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-white);
  border-left: 4px solid var(--color-white);
}

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.mobile-menu-btn span {
  width: 25px;
  height: 3px;
  background: var(--color-white);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ============================================
   Page Section Management
   ============================================ */

.page-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   Page Header Styles
   ============================================ */

.page-header {
  background: linear-gradient(135deg, #1a5490 0%, #0052CC 100%);
  color: var(--color-white);
  padding: 2rem 1rem;
  text-align: center;
}

.page-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   Calendar Specific Styles
   ============================================ */

.content-section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.calendar-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.calendar-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calendar-table th,
.calendar-table td {
  padding: 1rem;
  text-align: center;
  border: 1px solid #e5e7eb;
}

.calendar-table th {
  background: #0052CC;
  color: #fff;
  font-weight: 600;
}

.calendar-table td:hover {
  background: #e0e7ff;
  cursor: pointer;
}

.events-list {
  background: #f8f8f8;
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid #0052CC;
}

.events-list h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: #22223b;
}

.events-list ul {
  list-style: none;
  padding: 0;
}

.events-list li {
  padding: 0.8rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.events-list li:last-child {
  border-bottom: none;
}

/* ============================================
   Footer
   ============================================ */

.portal-footer {
  background: var(--color-secondary);
  color: var(--color-white);
  padding: 3rem 1rem 1rem 1rem;
  margin-top: 3rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-white);
}

.footer-title {
  font-size: 1.3rem;
}

.footer-text {
  font-size: 0.9rem;
  color: var(--color-primary-light);
  margin: 0.3rem 0;
}

.footer-desc {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--color-white);
}

.footer-section p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0.3rem 0;
}

.footer-bottom {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 900px) {
  .nav-menu {
    gap: 0;
  }

  .nav-link {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .header-container {
    gap: 1rem;
  }

  .logo-text h1 {
    font-size: 1.2rem;
  }

  body {
    margin-left: 200px;
  }

  .portal-nav {
    width: 200px;
  }

  .nav-link {
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .calendar-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  body {
    margin-left: 0;
  }

  .portal-nav {
    display: none;
  }

  .page-header {
    padding: 1.5rem 1rem;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .content-section {
    padding: 1rem;
  }

  .logo-img {
    width: 40px;
    height: 40px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 400px) {
  .header-logo {
    gap: 0.5rem;
  }

  .logo-text h1 {
    font-size: 1rem;
  }

  .portal-tagline {
    font-size: 0.7rem;
  }

  .page-title {
    font-size: 1.1rem;
  }
}

/* ============================================
   Real-Time Clock Styles
   ============================================ */

.real-time-clock {
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: inline-block;
}

.clock-time {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
}

.clock-date {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 0.25rem;
}

/* ============================================
   Dynamic Calendar Grid Styles
   ============================================ */

.calendar-wrapper {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.month-year-display {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.nav-btn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:hover {
  background: var(--color-primary-dark);
  transform: scale(1.1);
}

.nav-btn:active {
  transform: scale(0.95);
}

.today-btn {
  display: block;
  margin: 0 auto 1rem;
  padding: 0.5rem 1.5rem;
  background: var(--color-success);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.today-btn:hover {
  background: #0d9668;
  transform: translateY(-2px);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  min-height: 300px;
}

.calendar-day-header {
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-accent);
  border-radius: 4px;
  font-size: 0.85rem;
}

.calendar-day {
  position: relative;
  padding: 0.75rem 0.5rem;
  min-height: 50px;
  text-align: center;
  background: #f9fafb;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.calendar-day:hover {
  background: var(--color-accent);
  transform: translateY(-2px);
}

.calendar-day.other-month {
  color: #ccc;
  background: transparent;
}

.calendar-day.other-month:hover {
  background: transparent;
  transform: none;
  cursor: default;
}

.calendar-day.today {
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
}

.calendar-day.today:hover {
  background: var(--color-primary-dark);
}

.calendar-day.selected {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
}

.calendar-day.has-event {
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
}

.calendar-day.has-event.today {
  background: var(--color-primary);
  border-left: 3px solid #fff;
}

.day-number {
  font-size: 0.95rem;
}

.event-indicator {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: var(--color-error);
  color: #fff;
  border-radius: 50%;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Calendar Animations */
.calendar-grid.slide-left {
  animation: slideLeft 0.3s ease-out;
}

.calendar-grid.slide-right {
  animation: slideRight 0.3s ease-out;
}

.calendar-grid.fade {
  animation: fadeIn 0.3s ease-out;
}

@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================
   Selected Date Events Panel
   ============================================ */

.selected-date-events {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  display: none;
}

.selected-date-events.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.selected-date-header h3 {
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.no-events {
  text-align: center;
  color: var(--color-text-light);
  padding: 1rem;
}

.event-card {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--color-primary);
}

.event-card:last-child {
  margin-bottom: 0;
}

.event-time {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 0.25rem;
}

.event-title {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.event-type-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--color-accent);
  color: var(--color-primary);
  border-radius: 12px;
  font-size: 0.75rem;
  text-transform: capitalize;
}

/* Event Type Colors */
.event-card.event-community { border-left-color: #10b981; }
.event-card.event-official { border-left-color: #0052CC; }
.event-card.event-health { border-left-color: #ef4444; }
.event-card.event-training { border-left-color: #f59e0b; }
.event-card.event-event { border-left-color: #8b5cf6; }
.event-card.event-maintenance { border-left-color: #6b7280; }

/* ============================================
   Upcoming Events List Styles
   ============================================ */

.events-list {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  border-left: 4px solid var(--color-primary);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  height: fit-content;
}

.events-list h2 {
  font-size: 1.2rem;
  margin-bottom: 1.25rem;
  color: var(--color-text);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.events-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.event-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #e5e7eb;
  transition: all var(--transition);
}

.event-item:last-child {
  border-bottom: none;
}

.event-item:hover {
  background: #f8fafc;
  margin: 0 -0.5rem;
  padding: 1rem 0.5rem;
  border-radius: 8px;
}

.event-date-badge {
  min-width: 50px;
  padding: 0.5rem;
  background: var(--color-primary);
  color: #fff;
  border-radius: 8px;
  text-align: center;
}

.event-day {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}

.event-month {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-top: 2px;
}

.event-info {
  flex: 1;
}

.event-info strong {
  display: block;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.event-time-small {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

/* Event type indicators for list items */
.event-item.event-community .event-date-badge { background: #10b981; }
.event-item.event-official .event-date-badge { background: #0052CC; }
.event-item.event-health .event-date-badge { background: #ef4444; }
.event-item.event-training .event-date-badge { background: #f59e0b; }
.event-item.event-event .event-date-badge { background: #8b5cf6; }
.event-item.event-maintenance .event-date-badge { background: #6b7280; }

/* ============================================
   Event Legend
   ============================================ */

.event-legend {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.event-legend h4 {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-bottom: 0.4rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.community { background: #10b981; }
.legend-dot.official { background: #0052CC; }
.legend-dot.health { background: #ef4444; }
.legend-dot.training { background: #f59e0b; }
.legend-dot.event { background: #8b5cf6; }
.legend-dot.maintenance { background: #6b7280; }

/* ============================================
   Mobile Navigation Enhancement
   ============================================ */

.portal-nav.mobile-open {
  display: block;
  position: fixed;
  animation: slideInNav 0.3s ease;
}

@keyframes slideInNav {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* ============================================
   Enhanced Responsive Design
   ============================================ */

@media (max-width: 900px) {
  .calendar-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .calendar-wrapper {
    order: 1;
  }

  .events-list {
    order: 2;
  }
}

@media (max-width: 600px) {
  .real-time-clock {
    padding: 0.5rem 1rem;
  }

  .clock-time {
    font-size: 1.3rem;
  }

  .clock-date {
    font-size: 0.8rem;
  }

  .calendar-wrapper {
    padding: 1rem;
  }

  .month-year-display {
    font-size: 1.1rem;
  }

  .nav-btn {
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
  }

  .calendar-day {
    padding: 0.5rem 0.25rem;
    min-height: 42px;
  }

  .day-number {
    font-size: 0.85rem;
  }

  .calendar-day-header {
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
  }

  .event-indicator {
    width: 14px;
    height: 14px;
    font-size: 0.6rem;
    bottom: 2px;
    right: 2px;
  }

  .events-list {
    padding: 1rem;
  }

  .event-date-badge {
    min-width: 45px;
    padding: 0.4rem;
  }

  .event-day {
    font-size: 1rem;
  }

  .event-month {
    font-size: 0.6rem;
  }

  .event-info strong {
    font-size: 0.9rem;
  }
}

@media (max-width: 400px) {
  .calendar-grid {
    gap: 2px;
  }

  .calendar-day {
    min-height: 38px;
  }

  .day-number {
    font-size: 0.8rem;
  }

  .today-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
  }
}